home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Utilities / MView / gxu / gxattrib.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-30  |  4.2 KB  |  98 lines

  1. #pragma once
  2.  
  3. #ifndef __GXATTRIB_H__
  4. #define __GXATTRIB_H__
  5.  
  6. /*//////////////////////////////////////////////////////////////////////////////
  7. //
  8. // File: gxattrib.h
  9. //
  10. // Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  11. //
  12. //
  13. //////////////////////////////////////////////////////////////////////////////*/
  14.  
  15. // {EBEC8816-BDE9-4822-B7F4-4014EC9CD04F}
  16. DEFINE_GUID(IID_IGXAttributeBundle, 
  17. 0xebec8816, 0xbde9, 0x4822, 0xb7, 0xf4, 0x40, 0x14, 0xec, 0x9c, 0xd0, 0x4f);
  18.  
  19. // {79B52C0D-1287-432e-B3AF-82C53881EF79}
  20. DEFINE_GUID(IID_IGXAttributeBundleDX7, 
  21. 0x79b52c0d, 0x1287, 0x432e, 0xb3, 0xaf, 0x82, 0xc5, 0x38, 0x81, 0xef, 0x79);
  22.  
  23. // {38E7B518-9D45-4227-9C5B-B1F4E3CAB725}
  24. DEFINE_GUID(IID_IGXAttributeBundleSwitch, 
  25. 0x38e7b518, 0x9d45, 0x4227, 0x9c, 0x5b, 0xb1, 0xf4, 0xe3, 0xca, 0xb7, 0x25);
  26.  
  27.  
  28.  
  29. class IGXAttributeBundle : public IUnknown
  30. {
  31. public:
  32.  
  33.     // punch attribute set to device
  34.     virtual HRESULT SetAttributesToDevice( LPDIRECT3DDEVICE8 pDevice ) PURE;
  35.  
  36.     // user defined data
  37.     virtual HRESULT SetUserData( PVOID pvUserData ) PURE;
  38.     virtual HRESULT GetUserData( PVOID *ppvUserData ) PURE;
  39.  
  40.     // user defined sort index for preferred order to draw attribute bundle sets in
  41.     virtual HRESULT SetSortIndex( DWORD dwSortIndex ) PURE;
  42.     virtual HRESULT GetSortIndex( PDWORD pdwSortIndex ) PURE;
  43. };
  44.  
  45. class IGXAttributeBundleDX7 : public IGXAttributeBundle
  46. {
  47. public:
  48.     virtual HRESULT SetMaterial( D3DMATERIAL8 *pmat ) PURE;
  49.  
  50.     // set texture in a given stage
  51.     virtual HRESULT SetTexture( UINT Stage, LPDIRECT3DBASETEXTURE8 pTexture ) PURE;
  52.         // AddRef's and caches given texture pointer (then Release's old texture pointer, if it was non-NULL.)
  53.         // (make sure to Release after AddRef'ing in case before and after interface pointers are the same
  54.         // setting a given texture pointer to NULL disables preceding stages
  55.         // note, these semantics are quite similar to IDirect3DDevice3::SetTexture
  56.     virtual HRESULT GetTexture( UINT Stage , LPDIRECT3DBASETEXTURE8 *pOut) PURE;
  57.         // passes back NULL if no stage, otherwise AddRef's and passes back corresponding texture pointer
  58.     virtual HRESULT GetTextureCount( PUINT pcTextures ) PURE;
  59.         // passes back number of textures in cascade for this attribute bundle, or 0 if no textures.
  60.  
  61.     // the remaining entry points maintain DWORD pairs of state-to-change/new value. I am morally certain
  62.     // that DirectX ISVs maintain data structures that look much like this. Common attribute bundles can
  63.     // be initialized from static data in the application.
  64.     virtual HRESULT SetTextureStageStates( UINT Stage, LPDWORD pdwTSSPairs, UINT cTSSPairs ) PURE;
  65.     virtual HRESULT GetTextureStageStates( UINT Stage, LPDWORD pdwTSSPairs, PUINT pcTSSPairs ) PURE;
  66.         // NOTE for the Get* entry points: either or both of pdwTSSPairs or pcTSS can be NULL.
  67.         // If pdwTSSPairs is NULL, the client probably wants to know how many TSS pairs there are
  68.         // so it can do an allocation on its end. If pcTSS is NULL, the client probably knows how
  69.         // many states there are (or something). It's probably not interesting to check for both-NULL
  70.         // and return an error if that condition pertains.
  71.     virtual HRESULT SetRenderStates( LPDWORD pdwRSPairs, UINT cRSPairs ) PURE;
  72.     virtual HRESULT GetRenderStates( LPDWORD pdwRSPairs, PUINT pcRSPairs ) PURE;
  73.  
  74. };
  75.  
  76. class IGXAttributeBundleSwitch : public IGXAttributeBundle
  77. {
  78. public:
  79.  
  80.     // set the i'th attribute bundle to resolve to
  81.     virtual HRESULT SetAttributeBundle(UINT iAttributeBundle, IGXAttributeBundle *pattr) PURE;
  82.  
  83.     // get the i'th attribute bundle that would be resolved to
  84.     virtual HRESULT GetAttributeBundle(UINT iAttributeBundle, IGXAttributeBundle **ppattr) PURE;
  85.  
  86.     // get the total number of attribute bundles that can be resolved to
  87.     virtual HRESULT GetAttributeBundleCount( PUINT pcAttributeBundles ) PURE;
  88.  
  89.     // set the current attribute bundle to resolve to
  90.     virtual HRESULT SetCurrentAttributeBundle( UINT iAttributeBundle ) PURE;
  91. };
  92.  
  93.  
  94. HRESULT GXCreateAttributeBundleDX7(IGXAttributeBundleDX7 **ppattrNew);
  95. HRESULT GXCreateAttributeBundleSwitch(IGXAttributeBundleSwitch **ppattrNew, UINT cpattrResolveMax);
  96.  
  97. #endif
  98.